//
//  StatusPictureCell.m
//  weibo110
//
//  Created by 臧松 on 16/1/3.
//  Copyright © 2016年 臧松. All rights reserved.
//

#import "StatusPictureCell.h"
#import "UIImageView+WebCache.h"
#import "Masonry.h"
@interface StatusPictureCell()

@property (nonatomic,strong) UIImageView * iconView;

@end
@implementation StatusPictureCell
-(void)setImageUrl:(NSURL *)imageUrl{
    
    _imageUrl = imageUrl;
    [self.iconView sd_setImageWithURL:imageUrl placeholderImage:nil options:SDWebImageRetryFailed];
}
-(UIImageView *)iconView{
    if (_iconView == nil) {
        _iconView = [[UIImageView alloc]init];
        // 设置图片填充模式
        _iconView.contentMode = UIViewContentModeScaleAspectFill;
        // 需要裁切
        _iconView.clipsToBounds = YES;
    }
    return _iconView;
}
-(instancetype)initWithFrame:(CGRect)frame{
    if (self = [super initWithFrame:frame]) {
        
        [self setupUI];
    }
    return self;
}
// MARK: - 设置界面
-(void)setupUI{
    
    // 添加控件
    [self addSubview:self.iconView];
    // 自动布局
    [self.iconView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.edges.mas_equalTo(UIEdgeInsetsMake(0, 0, 0, 0));
    }];
    
}
@end
